part of 'api.dart';

extension ApiEngagement on _Api {
  Future<List<EngagementModel>?> getEngagementList({
    required int meetType,
    required String classifyId,
    required String cityName,
    required int page,
    required int pageSize,
  }) async {
    try {
      final resp = await httpInstance.get<EngagementModel>(
        url: 'meet/user/list',
        queryMap: {
          'meetType': meetType, //1-外围 2-楼凤
          'classifyId': classifyId,
          'cityName': cityName,
          'page': page,
          'pageSize': pageSize,
        },
        complete: EngagementModel.fromJson,
      );
      return resp ?? [];
    } catch (e) {
      return null;
    }
  }

  Future<List<EngagementModel>?> getStationMoreList({
    required int stationId,
    required int page,
    required int pageSize,
  }) async {
    try {
      final resp = await httpInstance.get<EngagementModel>(
        url: 'meet/user/station/more',
        queryMap: {
          'stationId': stationId,
          'page': page,
          'pageSize': pageSize,
        },
        complete: EngagementModel.fromJson,
      );
      return resp ?? [];
    } catch (e) {
      return null;
    }
  }

  Future<List<EngagementStationModel>?> getStationList({
    required int page,
    required int pageSize,
  }) async {
    try {
      final resp = await httpInstance.get<EngagementStationModel>(
        url: 'meet/user/station/list',
        queryMap: {
          'page': page,
          'pageSize': pageSize,
        },
        complete: EngagementStationModel.fromJson,
      );
      return resp ?? [];
    } catch (e) {
      return null;
    }
  }
}
